<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="vue.global.js"></script>
</head>
<body>
<div id = 'app'>
    <!--    n1的变化会触发n3的计算-->

    {{n1}} * {{n2}} = {{n3}}
</div>
<script>
    const app = Vue.createApp({
        data() {
            return {
                n1:3,
                n2:4
            }
        },
        computed:{
            n3(){
                return this.n1 * this.n2;
            }
        }

    });
    let vm = app.mount('#app');

    //n1的变化会触发n3的计算
    setTimeout(()=>{
        vm.n1 = 5;
    },2000)

</script>
</body>
</html>